package 方法的抽象和逐步求精;

public class Exercise5_9求素数 {

	public static boolean isPrime(int number){
		int c = 0;
		boolean flag = false;
		for (int i = 2; i < number; i++) {
			if(number % i != 0)
				c++;
		}
		if(c == number-2){
			System.out.println(number+"是素数！");
			flag=true;
		}else{
			System.out.println(number+"不是素数！");
		}
		return flag;
	}
	
	public static void main(String[] args) {
		isPrime(4);
	}
}
